package crm.sfh.server.entity;


import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.util.ArrayList;
import java.util.List;

import crm.sfh.server.SUser;

/**
 * Created by Administrator on 2018/2/28.
 */

public class EContent implements MultiItemEntity {

    public static final int TEXT = 1;

    public static final int IMG = 2;

    /**
     * 留言内容对象
     */
    ENote contentType;

    /**
     * 3个留言人员
     */
    List<EMessage> messagePerson = new ArrayList<> (3);


    public EUser getPerson() {

        return contentType.author;
    }


    public ENote getContentType() {

        return contentType;
    }

    public void setContentType(ENote contentType) {

        this.contentType = contentType;
        if (contentType.getFristMsg () != null) {
            messagePerson.add (contentType.getFristMsg ());
        }
        if (contentType.getTwoMsg () != null) {
            messagePerson.add (contentType.getTwoMsg ());
        }
        if (contentType.getThreeMsg () != null) {
            messagePerson.add (contentType.getThreeMsg ());
        }
    }

    public List<EMessage> getMessagePerson() {

        return messagePerson;
    }


    @Override
    public int getItemType() {

        int type = contentType.getType ();
        return type == 0 ? TEXT : IMG;
    }
}
